package com.zzq.my.jetpacks.jectpackapp.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.hjq.shape.view.ShapeTextView
import com.zzq.my.jetpacks.jectpackapp.R
import com.zzq.my.jetpacks.jectpackapp.bean.ItemInfo


/**
 * 描述：Rv 适配器
 * 作者：zhuangzeqin
 * 时间: 2021/12/23-14:53
 * 邮箱：zzq@eeepay.cn
 * 备注:
 */
class RvAdapter2:BaseQuickAdapter<ItemInfo,BaseViewHolder>(R.layout.item_rv2) {
    /**
     * Implement this method and use the helper to adapt the view to the given item.
     *
     * 实现此方法，并使用 helper 完成 item 视图的操作
     *
     * @param holder A fully initialized helper.
     * @param item   The item that needs to be displayed.
     */
    override fun convert(holder: BaseViewHolder, item: ItemInfo) {
        val view = holder.getView<ShapeTextView>(R.id.stv_item_name)
        view.text = item.name
        //adapter 中设置子元素的放大比例
        //adapter 中设置子元素的放大比例
//        val IV: ImageView = rvViewHolder.getView(com.zzq.my.jetpacks.jectpackapp.R.id.image_src)
//        IV.setImageResource(mData)

//        val lp: ViewGroup.LayoutParams = view.layoutParams
//        if (lp is FlexboxLayoutManager.LayoutParams) {
////            val flexboxLp = view.layoutParams as FlexboxLayoutManager.LayoutParams
//            lp.flexGrow = 1.0f
//        }
//        holder.setText(R.id.stv_item_name,item.name)//绑定视图
    }
}